package service;

import java.util.List;


import beans.*;
import dao.*;
public class AccountService {

    private AccountDAO accountDAO = new AccountDAO();

    /**
     * 获取账号链表
     * @return
     */
    public List<Account> selectAll(){
        return accountDAO.selectAll();
    }

	/**
	 * 插入账号
	 * @param account
	 * @return
	 */
	public int insertAccount(Account account)
	{
		return accountDAO.insertAccount(account);
	}

	/**
	 * 获取账号
	 * @param idNum
	 * @return
	 */
    public Account getAccount(String idNum)
	{
		return accountDAO.getAccount(idNum);
	}

	/**
	 * 删除账号
	 * @param idNum
	 * @return
	 */
    public int deleteAccount(String idNum)
	{
		Account account = new Account();
		account.setAno(Integer.parseInt(idNum));
		account.setAccountState(0);
//		account.setDeleteTime("2022-05-23");   
		return accountDAO.deleteAccount(account);
	
	}

	/**
	 * 更新账号
	 * @param account
	 * @return
	 */
    public int updateAccount(Account account) {
		return accountDAO.updateAccount(account);
	}
    
}
